import {
  createRouter,
  createWebHistory,
  type RouteRecordRaw,
} from "vue-router";
//RouteRecordRaw类型明确路由配置结构
//登录
import LoginPage from "@/views/login/LoginPage.vue";
//游客
import VisitorPage from "../views/visitor/VisitorPage.vue";
//管理员
import FeedbackManagement from "../views/admin/FeedbackManagement.vue";
import AdminHome from "../views/admin/AdminHome.vue";
import UserManagement from "../views/admin/UserManagement.vue";
//用户
import HeadPage from "@/views/user/pageHeader/HeadPage.vue";
import HomePage from "@/views/user/navigation/home/HomePage.vue";
import UserInfo from "@/views/user/navigation/userInfo/UserInfo.vue";
import DiseaseDiagnosis from "@/views/user/navigation/diagnosis/DiseaseDiagnosis.vue";
import UserDiagnosis from "@/views/user/navigation/diagnosis/userDiagnosis/UserDiagnosis.vue";
import DiagnosisReport from "@/views/user/navigation/diagnosis/diagnosisReport/DiagnosisReport.vue";
import PatientInfo from "@/views/user/navigation/patient/PatientInfo.vue";
import PatientList from "@/views/user/navigation/patient/patientList/PatientList.vue";
import PatientRecords from "@/views/user/navigation/patient/patientRecord/PatientRecords.vue";
import AppointmentManagement from "@/views/user/navigation/patient/appointment/AppointmentManagement.vue";
import DiagnosisInfo from "@/views/user/navigation/diagnosisInfo/DiagnosisInfo.vue";
import DiagnosisList from "@/views/user/navigation/diagnosisInfo/diagnosisList/DiagnosisList.vue";
import DiagnosisPatient from "@/views/user/navigation/diagnosisInfo/diagnosisPatient/DiagnosisPatient.vue";
import DiagnosisConfidence from "@/views/user/navigation/diagnosisInfo/diagnosisConfidence/DiagnosisConfidence.vue";
//患者
import PatientHome from "@/views/patient/PatientHome.vue";
import PatientOwnInfo from "@/views/patient/patientInfo/PatientOwnInfo.vue";
import PatientOperate from "@/views/patient/patientOperate/PatientOperate.vue";
import PatientAppointment from "@/views/patient/patientOperate/patientAppointment/PatientAppointment.vue";
import PatientReport from "@/views/patient/patientOperate/patientReport/PatientReport.vue";
import AiAssistant from "@/views/user/navigation/ai/AiAssistant.vue";

//路由配置数组类型
const routes: RouteRecordRaw[] = [
  {
    path: "/",
    redirect: "/login",
  },
  {
    path: "/login",
    component: LoginPage,
  },
  {
    path: "/visitor",
    component: VisitorPage,
  },
  {
    path: "/user",
    component: HeadPage,
    children: [
      {
        path: "home",
        component: HomePage,
      },
      {
        path: "info",
        component: UserInfo,
      },
      {
        path: "ai-assistant",
        component: AiAssistant,
      },
      {
        path: "diseaseDiagnosis",
        component: DiseaseDiagnosis,
        name: "diseaseDiagnosis",
        children: [
          {
            path: "userDiagnosis",
            name: "userDiagnosis",
            component: UserDiagnosis,
          },
          {
            path: "diagnosisReport",
            name: "diagnosisReport",
            component: DiagnosisReport,
          },
        ],
      },
      {
        path: "patientInfo",
        component: PatientInfo,
        children: [
          {
            path: "patientList",
            name: "patientList",
            component: PatientList,
          },
          {
            path: "patientRecords",
            name: "patientRecords",
            component: PatientRecords,
          },
          {
            path: "appointmentManagement",
            name: "appointmentManagement",
            component: AppointmentManagement,
          },
        ],
      },
      {
        path: "diagnosisInfo",
        component: DiagnosisInfo,
        children: [
          {
            path: "diagnosisList",
            name: "diagnosisList",
            component: DiagnosisList,
          },
          {
            path: "diagnosisPatient",
            name: "diagnosisPatient",
            component: DiagnosisPatient,
          },
          {
            path: "diagnosisConfidence",
            name: "diagnosisConfidence",
            component: DiagnosisConfidence,
          },
        ],
      },
    ],
  },
  {
    path: "/admin",
    component: AdminHome,
    children: [
      {
        path: "user-management",
        component: UserManagement,
      },
      {
        path: "feedback-management",
        component: FeedbackManagement,
      },
    ],
  },
  {
    path: "/patient",
    component: PatientHome,
    children: [
      {
        path: "patientOwnInfo",
        component: PatientOwnInfo,
      },
      {
        path: "patientOperate",
        component: PatientOperate,
        children: [
          {
            path: "patientAppointment",
            name: "patientAppointment",
            component: PatientAppointment,
            props: true,
          },
          {
            path: "patientReport",
            name: "patientReport",
            component: PatientReport,
            props: true,
          },
        ],
      },
    ],
  },
];

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes,
});

export default router;
